package com.zw.admin.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import com.zw.admin.server.model.FarmWeather;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface FarmWeatherDao {

    @Select("select * from farm_weather t where t.id = #{id}")
    FarmWeather getById(Long id);

    @Delete("delete from farm_weather where id = #{id}")
    int delete(Long id);

    int update(FarmWeather farmWeather);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into farm_weather(最低温度, 最高温度, 质量, 状态, 日期, 地区) values(#{最低温度}, #{最高温度}, #{质量}, #{状态}, #{日期}, #{地区})")
    int save(FarmWeather farmWeather);
    
    int count(@Param("params") Map<String, Object> params);

    List<FarmWeather> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
    List<FarmWeather> select(Map<String, Object> farmMap);


        @Select("select * from farm_weather")
        List<FarmWeather> getWeatherList();



}
